package com.working.project.ui.main

import androidx.databinding.ObservableInt
import androidx.lifecycle.ViewModel
import androidx.lifecycle.liveData
import com.working.libbase.model.ArticleResponse
import com.working.libcommon.adapter.PagingDataSource
import com.working.project.data.remote.ProjectServices

class ProjectViewModel(private val projectServices: ProjectServices) : ViewModel() {
    val cid = ObservableInt()

    val dataSource: PagingDataSource<ArticleResponse> = PagingDataSource(startPageNumber = 1) {
        projectServices.getProjectList(it.pageNo, cid.get()).data?.datas
    }

    val projectTree = liveData { emit(projectServices.getProjectTree()) }
}